import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GoodsBrandVO, GoodsBrandForm, GoodsBrandQuery } from '@/api/mall/goodsBrand/types';

/**
 * 查询品牌管理列表
 * @param query
 * @returns {*}
 */

export const listGoodsBrand = (query?: GoodsBrandQuery): AxiosPromise<GoodsBrandVO[]> => {
  return request({
    url: '/mall/goodsBrand/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询品牌管理详细
 * @param id
 */
export const getGoodsBrand = (id: string | number): AxiosPromise<GoodsBrandVO> => {
  return request({
    url: '/mall/goodsBrand/' + id,
    method: 'get'
  });
};

/**
 * 新增品牌管理
 * @param data
 */
export const addGoodsBrand = (data: GoodsBrandForm) => {
  return request({
    url: '/mall/goodsBrand',
    method: 'post',
    data: data
  });
};

/**
 * 修改品牌管理
 * @param data
 */
export const updateGoodsBrand = (data: GoodsBrandForm) => {
  return request({
    url: '/mall/goodsBrand',
    method: 'put',
    data: data
  });
};

/**
 * 删除品牌管理
 * @param id
 */
export const delGoodsBrand = (id: string | number | Array<string | number>) => {
  return request({
    url: '/mall/goodsBrand/' + id,
    method: 'delete'
  });
};
